<template>
<div>
<!--  <van-tabs v-model="active">-->
<!--    <van-tab title="标签 1">内容 1</van-tab>-->
<!--    <van-tab title="标签 2">内容 2</van-tab>-->
<!--    <van-tab title="标签 3">内容 3</van-tab>-->
<!--    <van-tab title="标签 4">内容 4</van-tab>-->
<!--  </van-tabs>-->

  <van-tabs keep-alive  v-model="active" swipeable @change="press">
    <van-tab   :title="item.name"  v-for="(item,index) in list" :key="index">

<!--      <router-link :to="{path:'/detail',query:{categoryId:item.articleId}}">-->
        <newOne :tonewOne="item.categoryId"></newOne>

<!--      <router-link to="{path:'/index">-->

<!--      </router-link>-->

    </van-tab>
  </van-tabs>
</div>
</template>

<script>
import {newList} from "@/api/http";
import newOne from './newOne'

export default {
name: "switchOne",
  components:{
  newOne
  },
  data(){
  return {
    active: 0,
    list:[],
    listOne:[],
    name:'',
    // undefined: undefined
    }
  },
  created() {


    console.log(this.active)
    newList(0,10).then(res=>{
      console.log(res)
      this.list = res.rows
      this.name = res.rows.articleId
      // this.listTwo[res.rows.articleId].pageNum = this.msg
      // console.log(this.name)
    })


  },
  mounted() {
    console.log(localStorage.getItem('active'))
    this.active = localStorage.active == undefined? 0: Number(localStorage.active)
  },
  methods:{
  press(name){
    console.log(name)
    localStorage.setItem('active',this.active)
  },

  }
}
</script>

<style scoped lang="less">
/deep/.van-tabs__line {
  //display: none;
  background-color: rgb(103,171,214);
}
/deep/.van-tab--active {
  color:rgb(103,171,214);
}
</style>